home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-03-06 | 1.9 KB | 54 lines | [TEXT/GEOL] |
- Item 1147123 4-Nov-90 13:02PST
-
- From: V0683 Amoco Tech, Eric Berdahl,VAR
-
- To: GER.XSE0096 Germany - Ciechowski Computer,IDV
- MACAPP.TECH$ MacApp Technical
-
- Sub: Re: HELP, EachSubView via C++…
-
- Ingo,
-
- Because you are using C++ and MacApp is "using" Pascal concepts, you must
- emulate those concepts in your code. The one concept you've stumbled on here
- is the use of local procedures. Normally, you'd do something like this in
- pascal.
-
- PROCEDURE TMAMandat.DoMakeViews(forPrinting: Boolean);
- VAR
- status: TWindow;
- PROCEDURE init_it(view: TView);
- VAR
- zwerg: String;
- BEGIN
- zwerg := gMaster.GetData(view.fIdentifier);
- TStaticText(view).SetText(zwerg, false);
- END;
- BEGIN
- IF NOT forPrinting THEN
- BEGIN
- status := NewTemplateWindow(WiDMaStatus, SELF);
- FailNIL(status);
- TView(status).fDocument := SELF;
- TView(status).EachSubView(init_it);
- status.Open;
- END;
- END;
-
- Notice that the Pascal version of your routine has no second argument for
- EachSubView, or at least not one you can see. Since init_it is a local
- procedure, it has access to all the local variables of its enclosing procedure,
- DoMakeViews. The way pascal handles this is to pass the A6 register, called
- the "static link", as a parameter. Thus, init_it has a base from which to
- reference the local variables of DoMakeViews. Since C++ has no similar
- concept, you may pass anything there. Some people like passing this, others
- create a struct that contains copies of the variables they want to access and
- pass its address. It's entirely up to you. I suggest that you read Tech Note
- 265 - Pascal to C: PROCEDURE parameters.
-
- Hope this helps,
- Eric Berdahl
- Amoco Technology Company
- AppleLink: V0683
-
-